﻿using NHibernate;

namespace MediaSage.Lib.UIFramework
{
    /// <summary>
    /// This is the base class for handling all messaging between the various componenents of MediaSageLib and the UI layers (MediaCenter App mainly)
    /// These could also be used by the windows application in theory, via polling
    ///
    /// The UIServer class will be implemented by the service application and handle messaging.  Messages come in one of several types
    /// <list type="bullet">
    /// <term>Simple Message: Displays a string, has an OK button</term>
    /// <term>Yes/No Message: Displays a string, gets a true/false answer</term>
    /// <term>List of String: Displays a list of options, lets a user choose one, returns the number of the option picked</term>
    /// </list>
    /// </summary>
    public class UIServer
    {
        protected string theme;
        protected Configuration.Config config;

        private ISessionFactory sessionFactory;

        public UIServer(Configuration.Config Config)
        {
            this.theme = "Default";
            this.config = Config;
        }

        /// <summary>
        /// Used to define the theme, each object when drawn will verify it has a proper object defined in the theme
        /// If it does not it will default to the default theme and drop a warning
        /// </summary>
        /// <param name="Config"></param>
        /// <param name="theme"></param>
        public UIServer(Configuration.Config Config, string theme)
        {
            this.config = Config;
            this.theme = theme;
        }

        public string Theme
        {
            get { return theme; }
            set { theme = value; }
        }

        public ISession GetSession()
        {
            return sessionFactory.GetCurrentSession();
        }
    }
}